<template>
	<view class="content">
		<view v-for="(item,index) in list" :key="index" @click="open(index)">
			<view class="" style="display: flex; justify-content: center;">
				<u-icon :name="item.icon" color="#2979ff" size="100"></u-icon>
				<view class="">
					{{item.name}}
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import mqttUtil from '../../utils/mqtt'
	const mqttll = new mqttUtil()
	export default {
		data() {
			return {
				list: [{
					name: '空调',
					url: '/pages/airconditioning/airconditioning',
					icon: 'chrome-circle-fill',
					code: {
						action: 'kongtiao',
						view: 'start'
					}
				}, {
					name: '一键息屏',
					url: '/pages/xiping',
					icon: 'chrome-circle-fill',
					code: {
						action: 'xiping',
						view: 'start'
					}
				}]
			}
		},
		onLoad() {

		},
		methods: {
			open(i) {
				// console.log(this.list[i].code);
				mqttll.sendMes("pageChange", JSON.stringify(this.list[i].code));
				uni.navigateTo({
					url: this.list[i].url
				})
			},

			airconditioning() {
				mqttll.sendMes('dakai', '01')
				uni.reLaunch({
					url: '/pages/airconditioning/airconditioning'
				})
			},
			Resting() {
				mqttll.sendMes("xiping", '02')
				uni.reLaunch({
					url: '/src/pages/xiping'
				})
			}

		}
	}
</script>

<style>
	.content {
		text-align: center;
		font-weight: bold;
		font-size: 32px;
		line-height: 100px;
	}
</style>